package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

import controller.viewController.MainmenueController;



public class Mainmenue {

	public MainmenueController mmc;


	
	public JFrame frame;

	/**
	 * Launch the application.
	 */
//	public void init() {
//		EventQueue.invokeLater(new Runnable() {
//			@Override
//			public void run() {
//				try {
//					Mainmenue window = new Mainmenue();
//					window.frame.setVisible(true);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//		});
//	}

	
	/**
	 * Create the application.
	 */
	public Mainmenue() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setResizable(false);
		frame.setBounds(100, 100, 730, 475);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JButton btnTrainingConfig = new JButton("Training konfigurieren");
		btnTrainingConfig.setBounds(30, 60, 150, 23);
		frame.getContentPane().add(btnTrainingConfig);
		btnTrainingConfig.addActionListener(action_btnTrainingConfig);
		
		JButton btnTrainingChange = new JButton("Training \u00E4ndern");
		btnTrainingChange.setBounds(195, 60, 150, 23);
		frame.getContentPane().add(btnTrainingChange);
		btnTrainingChange.addActionListener(action_btnTrainingChange);
		
		JButton btnProductDefine = new JButton("Produkt definieren");
		btnProductDefine.setBounds(525, 60, 150, 23);
		frame.getContentPane().add(btnProductDefine);
		btnProductDefine.addActionListener(action_btnProductConfig);

		
		JButton btnTrainingDelete = new JButton("Training l\u00F6schen");
		btnTrainingDelete.setBounds(360, 60, 150, 23);
		frame.getContentPane().add(btnTrainingDelete);
		btnTrainingDelete.addActionListener(action_btnTrainingDelete);
				
		JButton btnCustomerManagement = new JButton("Kunden verwalten");
		btnCustomerManagement.setBounds(195, 130, 150, 23);
		frame.getContentPane().add(btnCustomerManagement);
		btnCustomerManagement.addActionListener(action_btnCustomerManagement);
		
		JButton btnLeave = new JButton("PlEnTra verlassen");
		btnLeave.setBounds(360, 130, 150, 23);
		frame.getContentPane().add(btnLeave);
		btnLeave.addActionListener(action_btnLeave);
		
		JLabel lblBotlane = new JLabel("Standort");
		lblBotlane.setBounds(0, 426, 670, 14);
		lblBotlane.setHorizontalAlignment(SwingConstants.CENTER);
		frame.getContentPane().add(lblBotlane);
		
		frame.setVisible(true);
	}
	
	
		
	public ActionListener action_btnTrainingConfig = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			frame.setVisible(false);
			mmc.goToTrainingConfig();
			
		}
	};
	
	public ActionListener action_btnTrainingChange = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			frame.setVisible(false);
			mmc.goToTrainingChange();
		}
	};
	
	public ActionListener action_btnProductConfig = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			frame.setVisible(false);
			mmc.goToDefineProduct();
			
		}
	};
	
	public ActionListener action_btnTrainingDelete = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			frame.setVisible(false);
			mmc.goToDeleteTraining();
			
		}
	};
	
	public ActionListener action_btnCustomerManagement = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {

			frame.setVisible(false);
			mmc.goToCustomerManagement();
			
		}
	};
	
	public ActionListener action_btnLeave = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			
			frame.setVisible(false);
			mmc.backOrLeave();
			
		}
	};
}
